import com.dji.wpmz.WpmzJni;
import java.util.Arrays;

public class Example {
    public static void main(String[] args) {
        WpmzJni wpmz = new WpmzJni();
        
        // 创建 Document 对象
        WpmzJni.Document doc = new WpmzJni.Document();
        
        // 设置文档属性
        doc.createTime = System.currentTimeMillis();
        doc.updateTime = System.currentTimeMillis();
        
        // 添加航点
        WpmzJni.Waypoint waypoint1 = new WpmzJni.Waypoint(113.958298915883, 22.5428601764565);
        WpmzJni.Waypoint waypoint2 = new WpmzJni.Waypoint(113.957794329494, 22.5424452667718);
        
        doc.wayline.waypoints = Arrays.asList(waypoint1, waypoint2);
        
        // 转换为 KML
        String kml = wpmz.toTemplate(doc);
        System.out.println("KML: " + kml);
        
        // 打包
        byte[] packed = wpmz.pack(doc);
        System.out.println("Packed size: " + packed.length);
        
        // 解包
        WpmzJni.Document unpackedDoc = wpmz.unpack(packed);
        System.out.println("Unpacked document created at: " + unpackedDoc.createTime);
    }
}
